package com.frxuexi.mine.viewmodel

import com.frxuexi.lib_base.BaseViewModel
import com.frxuexi.lib_base.entity.BaseEntity
import com.frxuexi.mine.intent.UserIntent
import com.frxuexi.mine.repository.UserRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

@HiltViewModel
class UserViewModel @Inject constructor(private val userRepository: UserRepository):BaseViewModel<UserIntent>() {
    override fun handleIntent(it: UserIntent) {
        when(it){
            is UserIntent.register->{
                httpRequest2(userRepository.register(it.map))
            }
            is UserIntent.login->{
                httpRequest2((userRepository.login(it.map)))
            }
        }
    }
}